﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.Concesiones
{
    public class ConcesionByGuidSpecification
        : Specification<Concesion>
    {
        #region Privates propierties

        private Guid _concesionGuid = default(Guid);

        #endregion  

        #region Constructor

        public ConcesionByGuidSpecification(Guid concesionGuid)
        {
            if (concesionGuid == Guid.Empty)
                throw new InvalidOperationException(Messages.exception_InvalidArgument);
            _concesionGuid = concesionGuid;
        }

        #endregion  

        #region Specification overrides

        public override System.Linq.Expressions.Expression<Func<Concesion, bool>> SatisfiedBy()
        {
            Specification<Concesion> specification = new DirectSpecification<Concesion>(concesion => concesion.ConcesionGuid == _concesionGuid);
            return specification.SatisfiedBy();
        }

        #endregion
    }
}
